.\"
.\" The contents of this file are subject to the terms of the
.\" Common Development and Distribution License (the "License").
.\" You may not use this file except in compliance with the License.
.\"
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
.\" or http://www.opensolaris.org/os/licensing.
.\" See the License for the specific language governing permissions
.\" and limitations under the License.
.\"
.\" When distributing Covered Code, include this CDDL HEADER in each
.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
.\" If applicable, add the following below this CDDL HEADER, with the
.\" fields enclosed by brackets "[]" replaced with your own identifying
.\" information: Portions Copyright [yyyy] [name of copyright owner]
.\"
.\"
.\" Copyright 1989 AT&T
.\" Copyright (c) 2004, Sun Microsystems, Inc. All Rights Reserved
.\" Copyright 2016 Nexenta Systems, Inc.
.\" Copyright 2020 Joyent, Inc.
.\"
.Dd February 4, 2020
.Dt NFSD 8
.Os
.Sh NAME
.Nm nfsd
.Nd NFS daemon
.Sh SYNOPSIS
.Nm /usr/lib/nfs/nfsd
.Op Fl a
.Op Fl c Ar max_conn
.Op Fl l Ar listen_backlog
.Op Fl p Ar protocol
.Op Fl t Ar device
.Op Ar nservers
.Sh DESCRIPTION
.Nm
is the daemon that handles client file system requests.
Only users with
.Brq Sy PRIV_SYS_NFS
and sufficient privileges to write to
.Pa /var/run
can run this daemon.
.Pp
The
.Nm
daemon is automatically invoked using
.Xr share 8
with the
.Fl a
option.
.Pp
By default,
.Nm
starts over the TCP and UDP transports for versions 2 and 3.
By default, it starts over the TCP for version 4.
You can change this with the
.Fl p
option.
.Pp
A previously invoked
.Nm
daemon started with or without options must be stopped before invoking another
.Nm
command.
.Pp
See
.Xr nfs 5
for available configuration properties for
.Nm .
.Ss Options
The following options are supported:
.Bl -tag -width Ds
.It Fl a
Start a NFS daemon over all available connectionless and connection-oriented
transports, including UDP and TCP.
Equivalent of setting the
.Sy protocol
property to
.Sy all .
.It Fl c Ar max_conn
Set the maximum number of connections allowed to the NFS server over
connection-oriented transports.
By default, the number of connections is unlimited.
Equivalent of the
.Sy max_connections
property.
.It Fl l
Set connection queue length for the NFS server over a connection-oriented
transport.
The default value is 32 entries.
Equivalent of the
.Sy listen_backlog
property.
.It Fl p Ar protocol
Start a NFS daemon over the specified protocol.
Equivalent of the
.Sy protocol
property.
.It Fl t Ar device
Start a NFS daemon for the transport specified by the given device.
Equivalent of the
.Sy device
property.
.El
.Ss Operands
The following operands are supported:
.Bl -tag -width Ds
.It Ar nservers
This sets the maximum number of concurrent NFS requests that the server can
handle.
This concurrency is achieved by up to
.Ar nservers
threads created as needed in the kernel.
.Ar nservers
should be based on the load expected on this server.
16 is the usual number of
.Ar nservers .
If
.Ar nservers
is not specified, the maximum number of concurrent NFS requests will default to
1.
Equivalent of the
.Sy servers
property.
.El
.Ss Usage
If the
.Sy nfs_portmon
variable is set to non-zero value in
.Pa /etc/system ,
then clients are required to use privileged ports
.Po ports <
.Dv IPPORT_RESERVED
.Pc
to get NFS services.
This variable is equal to zero by default.
This variable has been moved from the
.Qq nfs
module to the
.Qq nfssrv
module.
To set the variable, edit the
.Pa /etc/system
file and add this entry:
.Bd -literal -offset indent
set nfssrv:nfs_portmon = 1
.Ed
.Sh FILES
.Bl -tag -width Ds
.It Pa \&.nfsXXX
Client machine pointer to an open-but-unlinked file.
.It Pa /etc/system
System configuration information file.
.It Xo
.Pa /var/nfs/v4_state
.br
.Pa /var/nfs/v4_oldstate
.Xc
Directories used by the server to manage client state information.
These directories should not be removed.
.El
.Sh EXIT STATUS
.Bl -tag -width Ds
.It Sy 0
Daemon started successfully.
.It Sy 1
Daemon failed to start.
.El
.Sh SEE ALSO
.Xr svcs 1 ,
.Xr nfs 5 ,
.Xr sharetab 5 ,
.Xr system 5 ,
.Xr attributes 7 ,
.Xr smf 7 ,
.Xr zones 7 ,
.Xr mountd 8 ,
.Xr share 8 ,
.Xr sharectl 8 ,
.Xr sharemgr 8 ,
.Xr svcadm 8
.Sh NOTES
Manually starting and restarting
.Nm
is not recommended.
If it is necessary to do so, use
.Nm svcadm
to enable or disable the nfs service
.Pq svc:/network/nfs/server .
If it is disabled, it will be enabled by
.Xr share_nfs 8 ,
unless its
.Sy application Ns / Ns Sy auto_enable
property is set to
.Sy false .
See
.Xr smf 7
and
.Xr svcadm 8
for more information.
.Pp
The
.Nm
service is managed by the service management facility,
.Xr smf 7 ,
under the service identifier:
.Bd -literal -offset indent
svc:/network/nfs/server
.Ed
.Pp
Administrative actions on this service, such as enabling, disabling, or
requesting restart, can be performed using
.Xr svcadm 8 .
The service's status can be queried using the
.Xr svcs 1
command.
.Pp
If
.Nm
is killed with
.Sy SIGTERM ,
it will not be restarted by the service management facility.
Instead,
.Nm
can be restarted by other signals, such as
.Sy SIGINT .
.Pp
NFS service, which includes
.Nm ,
can run inside a non-global zone.
See the discussion under ZONES in
.Xr nfs 5
for more information.
